config.yml#
YAML File |
|
Schema File |
|
Loader Class |
|
Dumper Class |
|
Python Module |
|
Python Variable |
The schema of an Oklahoma-Standards-Compliant NG911 geodatabase is described by the config.yml file.
YAML Structure#
Top-Level Keys#
The root object is a mapping with the !NG911Config tag applied.
|
Mapping describing miscellaneous properties of the geodatabase as a whole. |
|
Sequence of mappings, each defining the properties of one geodatabase domain. |
|
Sequence of mappings, each defining a field used by NG911 feature classes. |
|
Sequence of mappings, each defining the properties of one NG911 feature class. |
Anchors#
|
Name of the required feature dataset. Intended for use in the |
|
Name of the optional feature dataset. Intended for use in the |
Domain Anchors#
Every domain under the domains top-level key should have an anchor whose name is equal to the name key of the domain with which it is associated. Every use of the !Domain tag in config.yml should also have such an anchor. These anchors are intended for use in the domain keys of mappings under the top-level fields key.
Field Anchors#
Every field under the fields top-level key should have an anchor whose name is equal to the role key of the field with which it is associated. Every use of the !Field tag in config.yml should also have such an anchor. These anchors are intended for use in the fields keys of mappings under the top-level feature_classes key.
Python Implementation#
The config Variable#
The module ng911ok.lib.session provides the _NG911Config class, which implements the !NG911Config tag, and its only instance, config, which exposes the data stored in config.yml.
Constructors for !CompleteDomainList, !CompleteFieldList, !FeatureClassList, and !FeatureClass/* are registered in ng911ok.lib.session. The remaining tags are implemented as subclasses of yaml.YAMLObject in ng911ok.lib.config_dataclasses.
Namespace Classes and fctypes.py#
The !FeatureClass/* constructor returns an instance of ng911ok.lib.config_dataclasses.NG911FeatureClass. The type of the returned instance’s fields attribute depends on the tag’s suffix (the part after the slash, such as AddressPoint in !FeatureClass/AddressPoint). More specifically, that attribute will be an instance of the class NG911<tag_suffix>FieldNamespace, where <tag_suffix> is the suffix previously described. All such classes are defined in ng911ok.lib.fctypes.
The fctypes module is unique in the ng911ok package in that it is programmatically generated. It should not be manually edited. If some sort of change is necessary, it should be accounted for in generate_fctypes.py, which is responsible for generating the code in fctypes. Having classes that correspond to the YAML helps provide for type-checking and autocomplete in IDEs.